bcc
### Block I/O size histogram
### bcc/examples/tracing/bitehist.py
from bcc import BPF
from time import sleep
# load BPF program
b = BPF(
text="""
...
""")
# header
print("Tracing... Hit Ctrl-C to end.")
# trace until Ctrl-C
try:
sleep(99999999)
except KeyboardInterrupt:
print
# output
b["dist"].print_log2_hist("kbytes")
#include <uapi/linux/ptrace.h>
#include <linux/blkdev.h>
BPF_HISTOGRAM(dist);
int kprobe__blk_account_io_completion(
struct pt_regs *ctx,
struct request *req
)
{
dist.increment(
bpf_log2l(
req->__data_len / 1024
)
);
return 0;
}
CPU profile: Flamegraphs
$ /usr/share/bcc/tools/profile -f 5 > profile.data
$ flamegraph profile.data > profile.svg
execsnoop
opensnoop
ext4slower (or btrfs*, xfs*, zfs*)
biolatency
biosnoop
cachestat
tcpconnect
tcpaccept
tcptrans
gethostlatency
runqlat
profile